package com.education.cms.dao;

import com.education.cms.domain.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface UserDao extends JpaRepository<User,Integer> {
    @Query("select user from User user where user.username=:username and user.password=:password")
    User loginUser(@Param("username") String username, @Param("password") String password);

    User findByUsername(String username);

    Page<User> findAll(Specification<User> specification, Pageable pageable);
}
